#!/bin/sh

while read local_ref local_sha remote_ref remote_sha
do
  echo "$local_ref"
  branch=$(git ls-remote |grep $local_ref)
  if [ "$local_ref" =~ "main" ]; then
      exit 0
  fi
  if [ "$local_ref" =~ "master" ]; then
      exit 0
  fi
  if [ -n "$branch" ]; then
    exit 0
  else
    echo "远端分支 $local_ref 不存在"
    exit 1
  fi
done
exit 0
